package com.example.forum.dao;

import com.example.forum.model.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article row);

    int insertSelective(Article row);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article row);

    int updateByPrimaryKeyWithBLOBs(Article row);

    int updateByPrimaryKey(Article row);

    //查询所有帖子集合
    List<Article> selectAll();

    //查询某个版块的帖子列表
    List<Article> selectByBoardId(@Param("boardId") Long boardId);

    //根据id查询帖子详情
    Article selectById(@Param("id") Long id);

    //更新帖子的访问量
    int updateVisitCountById(@Param("id") Long id);

    //根据用户id查询帖子列表
    List<Article> selectByUserId(@Param("userId") Long userId);
}